<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Array.prototype.sort() 的排序稳定性</title>
</head>

<body>
    
</body>
<script>
    const arr = [
  'peach',
  'straw',
  'apple',
  'spork'
];
const stableSorting = (s1, s2) => {
  if (s1[0] < s2[0]) return -1;
  return 1;
};
arr.sort()
console.log(arr);
</script>
</html>